package com.zzyl;

import com.zzyl.web.Student;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;

@SpringBootTest
public class RedisSerializeble {
    @Autowired
    private RedisTemplate<Object,Object> redisTemplate;
    @Test
    public void test(){
        Student s=new Student("张三",10,48);
        redisTemplate.opsForValue().set("stuendt",s);

        //将对象存到Redis中

    }
    @Test
    public void test2(){

        Student o = (Student) redisTemplate.opsForValue().get("stuendt");
System.out.println(o);
        //将对象存到Redis中

    }
}
